//
//  BrandDisDetailTableViewCell.m
//  Blank
//
//  Created by whg－54 on 15/9/25.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "BrandDisDetailTableViewCell.h"
#import "BrandDisplayModel.h"
#import <UIImageView+WebCache.h>
#import <Masonry.h>
@interface BrandDisDetailTableViewCell ()
@property (nonatomic , strong)UILabel *brandLabel;
@property (nonatomic , strong)UILabel *discribeLabel;
@property (nonatomic , strong)UIImageView *picView;
@property (nonatomic , strong)UILabel *priceLabe;
@property (nonatomic , strong)UIImageView *lineView;

@end
@implementation BrandDisDetailTableViewCell
#pragma mark - 重写初始化方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.brandLabel  =[[UILabel alloc]init];
        self.discribeLabel = [[UILabel alloc]init];
        self.picView = [[UIImageView alloc]init];
        self.priceLabe = [[UILabel alloc]init];
        self.lineView = [[UIImageView alloc]init];
        
        [self.contentView addSubview:self.brandLabel];
        [self.contentView addSubview:self.discribeLabel];
        [self.contentView addSubview:self.picView];
        [self.contentView addSubview:self.priceLabe];
        [self.contentView addSubview:self.lineView];
    }
    return self;
}

#pragma mark - 重写model类set方法
- (void) setModel:(BrandDisplayModel *)model
{
    self.brandLabel.text = model.titleStr;
    self.discribeLabel.text = model.discribeStr;
    [self.picView sd_setImageWithURL:[NSURL URLWithString:model.picUrl] placeholderImage:[UIImage imageNamed:@"zhanwei"]];
    self.priceLabe.text = model.priceStr;
}

#pragma mark - 布局控件
- (void)layoutSubviews
{
    
    [self.picView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(15*Height, 10*Windth, 15*Height, 295*Windth));
    }];
    
    self.brandLabel.font = [UIFont systemFontOfSize:14];
    [self.brandLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(25*Height, 85*Windth, 70*Height, 80*Windth));
    }];
    
    self.discribeLabel.font = [UIFont systemFontOfSize:12];
    self.discribeLabel.textColor = [UIColor grayColor];
    [self.discribeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(55*Height, 85*Windth, 30*Height, 80*Windth));
    }];
    
    self.priceLabe.textColor = [UIColor redColor];
    self.priceLabe.font = [UIFont systemFontOfSize:14];
    self.priceLabe.textAlignment = 1;
    [self.priceLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(45*Height, 275*Windth, 45*Height, 5*Windth));
    }];
    
    self.lineView.backgroundColor = [UIColor colorWithWhite:0.902 alpha:1.000];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.equalTo(self.contentView).with.insets(UIEdgeInsetsMake(119 * Height, 0, 0, 0));

        
        
    }];
    
    if ([NightModel getColorModel]) {
        self.contentView.backgroundColor = [UIColor grayColor];
        self.brandLabel.backgroundColor = [UIColor grayColor];
        self.discribeLabel.backgroundColor = [UIColor grayColor];
        self.priceLabe.backgroundColor = [UIColor grayColor];
        
        self.brandLabel.textColor = [UIColor whiteColor];
        self.discribeLabel.textColor = [UIColor whiteColor];
        self.priceLabe.textColor = [UIColor greenColor];
        
    }
    else{
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.brandLabel.backgroundColor = [UIColor whiteColor];
        self.discribeLabel.backgroundColor = [UIColor whiteColor];
        self.priceLabe.backgroundColor = [UIColor whiteColor];
        
        self.brandLabel.textColor = [UIColor blackColor];
        self.discribeLabel.textColor = [UIColor grayColor];
        self.priceLabe.textColor = [UIColor redColor];

    }
    
    
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
